//
//  Globals.h
//  DooiooOnline
//
//  Created by koki on 14-11-6.
//  Copyright (c) 2014年 dooioo. All rights reserved.
//

#ifndef DooiooOnline_Globals_h
#define DooiooOnline_Globals_h

//尺寸常量
#define APPFRAME                    [[UIScreen mainScreen] applicationFrame]
#define SCREENFRAME                 [[UIScreen mainScreen] bounds]
#define KNavBarHeight 64
#define KTabBarHeight 50
#define kPhoneNumberLength          11                          // 手机号码位数
//颜色常量
#define kScreenBounds               [UIScreen mainScreen].bounds
#define mainColor                   UIColorFromRGB(0xE74C3C)
#define KRedColor                   [UIColor colorWithRed:0.9098 green:0.3451 blue:0.2627 alpha:1]
#define kOrangeColor                [UIColor hexStringToColor:@"#ff6600"]
#define kLightBlackColor            [UIColor hexStringToColor:@"#333333"]
#define kDarkGrayColor              [UIColor hexStringToColor:@"#666666"]
#define kLightGrayColor             [UIColor hexStringToColor:@"#999999"]
#define kYellowColor                [UIColor hexStringToColor:@"#ffaa00"]
#define kMainColor                  [UIColor hexStringToColor:@"#222222"]
#define kCyanColor                  [UIColor hexStringToColor:@"#00c6d5"]
#define kNormalGray                 [UIColor hexStringToColor:@"#dddddd"]
#define kPlaceHoderColor            [UIColor hexStringToColor:@"#b9b9b9"]

#define kDefaultViewBackgroundColor [UIColor colorWithRed:239/255.0 green:239/255.0 blue:244/255.0 alpha:1]

//[UIColor colorWithRed:239/255.0 green:239/255.0 blue:244/255.0 alpha:1]
#define kBlueColor                  [UIColor hexStringToColor:@"#108aef"]
#define UIColorFromRGB(rgbValue)    [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
//16进制颜色值 (带alpha)
#define UIColorHexA(c,a) [UIColor colorWithRed:((c>>16)&0xFF)/255.0f green:((c>>8)&0xFF)/255.0f blue:((c)&0xFF)/255.0f alpha:(a)]

//字体 细黑体
#define HeitiFont(fontSize)         [UIFont fontWithName:@"STHeitiSC-Light" size:fontSize]

//单例
#define netEngine           ([MSNetEngine sharedInstance])
#define rootNavigation      (((AppDelegate*)[[UIApplication sharedApplication] delegate]).nav)
#define rootDelegate        ((AppDelegate *)[UIApplication sharedApplication].delegate)
#define rootContext         (((AppDelegate*)[[UIApplication sharedApplication] delegate]).managedObjectContext)

//消息名
#define MSViewControllerUpdateNotification      @"MSViewControllerUpdateNotification"
#define MSViewControllerRefreshNotification     @"MSViewControllerRefreshNotification"
#define MSLogoutNotification                    @"MSLogoutNotification"
#define MSLoginNotification                     @"MSLoginNotification"
#define MSCollectionStateChangedNotification    @"MSCollectionStateChangedNotification"

//宏常量
#define Receiver            @"Receiver"
#define kTabbarIndex        @"kTabbarIndex"
#define kSearchJump         @"kSearchJump"
#define kSearchKeyword      @"SearchKeyword"
#define kSearchKeywordType  @"SearchKeywordType"


//设备辨别
#define IS_IPAD             (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE           (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA           ([[UIScreen mainScreen] scale] >= 2.0)

#define SCREENWIDTH                APPFRAME.size.width
#define SCREENHEIGHT               APPFRAME.size.height
#define SCREEN_WIDTH        ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT       ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH   (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH   (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5         (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6         (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P        (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)



#endif





